<template>
  <div>
    <el-drawer
      title="详情"
      :before-close="handleClose"
      :visible.sync="dialog"
      direction="rtl"
      custom-class="drawer"
      ref="drawer"
    >
      <div class="drawer__content">
        <el-form :model="form">
            <el-form-item label="系统名称:" :label-width="formLabelWidth">
            <el-tag type="success">
              <i class="el-icon-s-home"></i>
              {{ SystemName }}</el-tag
            >
          </el-form-item>
          <el-form-item label="角色名称:" :label-width="formLabelWidth">
            {{ form.RoleName }}
          </el-form-item>
          <el-form-item label="角色状态:" :label-width="formLabelWidth">
            <span v-if="form.Status == 0">禁用</span>
            <span v-if="form.Status == 1">启用</span>
          </el-form-item>
          <el-form-item label="备注:" :label-width="formLabelWidth">
            <span>{{ form.Description }}</span>
          </el-form-item>
        </el-form>

        <div class="drawer__footer">
          <el-button @click="cancelForm" style="width: 45%">返 回</el-button>
          <el-button style="width: 45%" type="primary" @click="edit"
            >编 辑</el-button
          >
        </div>
      </div>
    </el-drawer>
    <addRole ref="addRole" />
  </div>
</template>

<script>
import { AccessModules_get } from "@/api/business";
import addRole from "./addRole";
export default {
  components: { addRole },
  name: "",
  data() {
    return {
      dialog: false,
      loading: false,
      form: {},
      SystemName: JSON.parse(localStorage.getItem("xmGlDetails")).SystemName,
      formLabelWidth: "100px",
    };
  },
  mounted() {},
  methods: {
    async show(data) {
      this.dialog = true;
    //   let res = await AccessModules_get(data.Id);
    //   this.form = res.data.response;
    this.form=data
    },
    handleClose(done) {
      this.dialog = false;
      this.$emit("getData");
    },
    cancelForm() {
      this.loading = false;
      this.dialog = false;
      this.$emit("getData");
    },
    edit() {
      this.$refs.addRole.show(this.form);
    },
  },
};
</script>

<style  scoped>
.drawer__footer {
  width: 100%;
  text-align: center;
  position: absolute;
  bottom: 12px;
}
/deep/ .el-form-item__label {
  font-size: 15px;
}
</style>
